home *** CD-ROM | disk | FTP | other *** search
- { Questo file puo essere distribuito e modificato liberamente
-
- Spero diverta voi quanto mi sono divertito io nel farlo
-
- Paolo Codiga
- Via St Antonio 14
- CH-6596 Gordola
- Svizzera
- Paolo_Codiga@MSN.COM
-
- Tel ++41 93 67.63.56 ++41 91 745.63.56 dal 14.10.1995
-
-
- Ogni idea e suggerimento sono ben accetti
-
- Grazie Paul
-
- }
-
-
- unit Main;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, ExtCtrls;
-
- type
- TForm1 = class(TForm)
- Pb: TPaintBox;
- Timer1: TTimer;
- procedure PbPaint(Sender: TObject);
- procedure FormResize(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm1.PbPaint(Sender: TObject);
- var ct : integer;
- cx, cy : integer;
- x1, y1, x2, y2, x3, y3, x4, y4 : integer;
- r, r1, a, b : real;
- angle : real;
- Hour, Min, Sec, MSec : Word;
- begin
- Pb.Canvas.Brush.Color := clBlack;
- Pb.Canvas.Rectangle(0,0,Clientwidth,ClientHeight);
- cx := ClientWidth div 2;
- cy := ClientHeight div 2;
- x1 := ClientWidth div 15 ;
- x2 := ClientWidth - ( ClientWidth div 15 );
- y1 := ClientHeight div 15 ;
- y2 := ClientHeight - ( ClientHeight div 15 );
- r := (x2 - y1) div 2;
- ct := 0;
- for ct := 0 to 11 do
- begin
- case ct of
- 0: Pb.Canvas.Brush.Color := clYellow;
- 1: Pb.Canvas.Brush.Color := 33023;
- 2: Pb.Canvas.Brush.Color := 16744703;
- 3: Pb.Canvas.Brush.Color := clRed;
- 4: Pb.Canvas.Brush.Color := clFuchsia;
- 5: Pb.Canvas.Brush.Color := clPurple;
- 6: Pb.Canvas.Brush.Color := clNavy;
- 7: Pb.Canvas.Brush.Color := clGreen;
- 8: Pb.Canvas.Brush.Color := clTeal;
- 9: Pb.Canvas.Brush.Color := clMaroon;
- 10: Pb.Canvas.Brush.Color := 8700415;
- 11: Pb.Canvas.Brush.Color := 4567505;
- end;
- angle := (360 -(ct * 30 +196)) * pi / 180;
- a := sin(angle) * r;
- b := cos(angle) * r;
- x3 := cx + round(a);
- y3 := cy + round(b);
- angle := (360 -(ct * 30 +165)) * pi / 180;
- a := sin(angle) * r;
- b := cos(angle) * r;
- x4 := cx + round(a);
- y4 := cy + round(b);
- Pb.Canvas.Pie(X1,Y1,X2,Y2,X3,Y3,X4,Y4);
- end;
- { disegno l'ora }
- x1 := ClientWidth div 11 ;
- x2 := ClientWidth - ( ClientWidth div 11 );
- y1 := ClientHeight div 11 ;
- y2 := ClientHeight - ( ClientHeight div 11 );
- r := (x2 - y1) div 2;
- Pb.Canvas.Brush.Color := clBlack;
- DecodeTime(Now,Hour,Min,Sec,MSec);
- angle := (360 - (Hour * 30 + Min * 0.5 +166)) * Pi / 180;
- a := sin(angle) * r;
- b := cos(angle) * r;
- x3 := cx + round(a);
- y3 := cy + round(b);
- angle := (360 - (Hour * 30 + Min * 0.5 +195)) * Pi / 180;
- a := sin(angle) * r;
- b := cos(angle) * r;
- x4 := cx + round(a);
- y4 := cy + round(b);
- Pb.Canvas.Pie(X1,Y1,X2,Y2,X3,Y3,X4,Y4);
-
- end;
-
- procedure TForm1.FormResize(Sender: TObject);
- begin
- form1.ClientHeight := ClientWidth;
- end;
-
- end.
-